<template>
  <div>
    <el-select
      v-model="value"
      :multiple="false"
      style="width: 100%"
      @change="handleChange"
      :placeholder="$t('labels.pleaseSelect')"
    >
      <el-option
        v-for="item in types"
        :key="item.value"
        :label="item.label"
        :value="item.value"
      >
      </el-option>
    </el-select>
  </div>
</template>
<script>
export default {
  data() {
    return {
      types: [],
      value: null,
    };
  },
  model: {
    prop: "type",
    event: "innerChange",
  },
  methods: {
    getData() {
      this.types = [
        {
          label: "public",
          value: "public",
        },
        {
          label: "confidential",
          value: "confidential",
        },
      ];
    },
    handleChange() {
      this.$emit("innerChange", this.value);
    },
  },
  watch: {
    type: {
      handler(val) {
        this.value = val;
      },
    },
  },
  mounted() {
    this.value = this.type;
    this.$nextTick(() => {
      this.getData();
    });
  },
  props: {
    type: {
      type: String,
      default: "",
    },
  },
};
</script>
